package com.zxbit.flash.presenter;

import com.zxbit.flash.BuildConfig;
import com.zxbit.flash.base.BasePresenter;
import com.zxbit.flash.common.UserInfo;
import com.zxbit.flash.mvpview.PersonalInfoMvpView;
import com.zxbit.flash.network.CustomConsumer;
import com.zxbit.flash.network.ParamsFactory;
import com.zxbit.flash.response.AuthResponse;
import com.zxbit.flash.response.PersonalInfoResponse;
import com.zxbit.flash.response.UserInformationResponse;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.functions.Consumer;

public class PersonalInfoPresenter extends BasePresenter {
    private PersonalInfoMvpView mvpView;

    public PersonalInfoPresenter(PersonalInfoMvpView mvpView) {
        this.mvpView = mvpView;
    }

    public void getPersonalData() {
        Map<String,Object>map=new HashMap<>();
        map.put("userUuid", UserInfo.getShowUuid());
        toSubScribe(req.getPersonalInfo(BuildConfig.channel, UserInfo.getToken(), ParamsFactory.getCommonParams(map)), new CustomConsumer<PersonalInfoResponse>() {
            @Override
            public void call(PersonalInfoResponse response) {
                mvpView.onGetDataNext(response);
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
                mvpView.onGetDataError(throwable);
            }
        });
    }
//
//    /**
//     * 获取认证状态
//     */
//    public void getAuthStatus() {
//        toSubScribe(req.getAuthStatus(UserInfo.getToken(), ParamsFactory.getCommonParams(null)), new CustomConsumer<AuthResponse>() {
//            @Override
//            public void call(AuthResponse response) {
//                mvpView.onGetDataNext(response);
//            }
//        }, new Consumer<Throwable>() {
//            @Override
//            public void accept(Throwable throwable) throws Exception {
//                mvpView.onGetDataError(throwable);
//            }
//        });
//    }

}
